#ifndef EDGE_H
#define EDGE_H

#include "gisgraph_global.h"

#include <QGraphicsItem>

class Graph;
class Vertex;
class EdgePrivate;

class GISGRAPHSHARED_EXPORT Edge : public QGraphicsItem
{
public:
	Edge(Graph *parent = 0);
	Edge(Graph *parent, Vertex* u, Vertex* v);

	void setParentGraph(Graph *g);
	Graph *parentGraph() const;
	virtual int type() const { return GisGraph::EdgeType; }
	QRectF boundingRect() const;
	virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
	QPainterPath shape() const;
	void setLine(const QLineF &line);
	QLineF line() const;
	void setColor(const QColor &color);
	QColor color() const;
	Vertex *u() const;
	Vertex *v() const;
	void setU(Vertex *u);
	void setV(Vertex *v);
	virtual double length() const;
private:
	EdgePrivate *d;
};

class GISGRAPHSHARED_EXPORT VirtualEdge : public Edge
{
public:
	int type() const { return GisGraph::VirtualEdgeType; }
	void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
	QList<Edge *> edges() const { return m_edges; }
	void setEdges(QList<Edge *> edges);
	void addEdge(Edge *e);
	double length() const;
	void clearEdges();
private:
	QList<Edge *> m_edges;
};

#endif // EDGE_H
